package response

import (
	"sync"
	"wzgames/internal/model/gamep"
	"wzgames/internal/model/roulettep"
)

var opBetNotePool *sync.Pool

// 通用投注信息池

func InitBetNotePool() {
	opBetNotePool = &sync.Pool{
		New: func() interface{} {
			return &gamep.BetNote{}
		},
	}
}

func AcquireBetNote() *gamep.BetNote {
	return opBetNotePool.Get().(*gamep.BetNote)
}

func ReleaseBetNote(value *gamep.BetNote) {
	value.Op = 0
	opBetNotePool.Put(value)
}

var opElapsePool *sync.Pool

// 新轮盘倒计时数据播报池

func InitElapsePacketPool() {
	opElapsePool = &sync.Pool{
		New: func() interface{} {
			return &roulettep.CurrentElapse{}
		},
	}
}

func AcquireElapse() *roulettep.CurrentElapse {
	return opElapsePool.Get().(*roulettep.CurrentElapse)
}

func ReleaseElapse(value *roulettep.CurrentElapse) {
	value.State = 0
	opElapsePool.Put(value)
}
